<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //1.计算两个数的合
    // function fn(){
    //   let num1 = 10
    //   let num2 = 20
    //   document.write(num1+num2)
    // }
    // fn()

    //2.计算1-100之间所有数的合
    function fn(){
      let sum = 0
      for(let i =1;i<=100;i++){
        sum += i
      }
      document.write(sum)
    }

    fn()

  </script>
</body>
</html>